import request from "./axios";
import {DEFAULT_PAGENUM, DEFAULT_PAGESIZE} from "@/constent";

/**
 * 获取系统信息，表、操作类型、结果
 * 日志查询显示
 * @returns {AxiosPromise}
 */
export const getLogPreInfo = () => {
    return request({
        url: '/sys/getLogPreSysInfo',
        method: 'get'
    })
}

/**
 * 获取反馈人信息
 * @returns {AxiosPromise}
 */
export const getNoticeList = (pageNum = DEFAULT_PAGENUM, pageSize = DEFAULT_PAGESIZE) => {
    return request({
        url:'/notice/getNoticeList',
        method:'get',
        params: {
            pageNum,
            pageSize
        }
    })
}

/**
 * 删除反馈人
 * @param id
 * @returns {AxiosPromise}
 */
export const removeNotice = (id) => {
    return request({
        url:'/notice/removeNotice',
        method:'get',
        params: {
            id
        }
    })
}

/**
 * 修改反馈人
 * @param data
 * @returns {Promise<AxiosResponse<any>>}
 */
export const updateNotice = (data) => {
    return request.post('/notice/updateNotice',data);
}

/**
 * 获得头衔列表
 * @param pageNum
 * @param pageSize
 * @returns {AxiosPromise}
 */
export const getRankListPage = (pageNum = DEFAULT_PAGENUM, pageSize = DEFAULT_PAGESIZE) => {
    return request({
        url:'/rank/getRankListPage',
        method:'get',
        params:{
            pageNum,pageSize
        }
    })
}

/**
 * 删除头衔
 * @param id
 * @returns {AxiosPromise}
 */
export const removeRank = (id) => {
    return request({
        url:'/rank/removeRank',
        method:'get',
        params:{
            id
        }
    })
}

/**
 * 添加或修改
 * @param data
 * @returns {Promise<AxiosResponse<any>>}
 */
export const updateRank = (data = {}) => {
    return request.post('/rank/updateRank',data);
}

/**
 * 修改添加公告
 * @param data
 * @returns {Promise<AxiosResponse<any>>}
 */
export const updateAnno = (data = {}) => {
    return request.post('/anno/updateAnno',data);
}

/**
 * 获得弹出层公告信息
 * @returns {AxiosPromise}
 */
export const getAnnoCommendInfo = () => {
    return request({
        url:'/anno/getAnnoCommendInfo',
        method:'get'
    })
}

/**
 * 获得公告列表
 * @returns {AxiosPromise}
 */
export const getAnnoList = () => {
    return request({
        url:'/anno/getAnnoList',
        method:'get'
    })
}

/**
 * 删除公告
 * @returns {AxiosPromise}
 */
export const removeAnno = (annoId) => {
    return request({
        url:'/anno/removeAnno',
        method:'get',
        params:{
            annoId
        }
    })
}

/**
 * 收到公告
 * @param annoId
 * @returns {AxiosPromise}
 */
export const knownAnno = (annoId) => {
    return request({
        url:'/anno/knownAnno',
        method:'get',
        params:{
            annoId
        }
    })
}
